<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>home</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--<link rel="stylesheet" type="text/css" href="styles.css">-->

<!-- 新 Bootstrap 核心 CSS 文件 -->
<link
	href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css"
	rel="stylesheet">

<!-- 可选的Bootstrap主题文件（一般不使用） -->
<script
	src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap-theme.min.css"></script>

<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
<script
	src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>

<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script
	src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>

<link rel="stylesheet" href="css/home.css" />
<!-- 标签页logo -->
<link rel="shortcut icon" href="img/logo2.ico" />

<script>
	// 判断不能为空
	function validateForm() {
		var x = document.forms["storeInfoForm"]["storeInfo.storeName"].value;
		if (x == null || x == "") {
			alert("店铺名称必须填写");
			return false;
		}
	}

	// 判断不能为空
	function validateForm1() {
		var x = document.forms["serviceCategoryForm"]["serviceCategory.serCateName"].value;
		if (x == null || x == "") {
			alert("服务类型名称必须填写");
			return false;
		}
	}

	// 判断不能为空
	function myFunction2() {
		var y = document.forms["serviceForm"]["service.serviceName"].value;
		if (y == null || y == "") {
			alert("服务名称必须填写");
			return false;
		}
		// 获取 id="service.servicePrice" 的值
		var x = document.getElementById("service.servicePrice").value;

		// 如果输入的值 x 不是数字，则提示错误 
		if (parseFloat(x).toString() == "NaN") {
			//if (!isNaN(x)) {
			alert("请填写数字格式，如：50");
			return false;
		}

	}

	// 判断不能为空
	function myFunction3() {
		var y = document.forms["vipForm"]["vip.vipName"].value;
		if (y == null || y == "") {
			alert("姓名必须填写");
			return false;
		}
	}
</script>
</head>

<body>
	<!-- 导航栏 -->
	<nav class="navbar navbar-default" role="navigation">
	<div class="container-fluid">
		<div class="navbar-header">
			<a class="navbar-brand" href="home.jsp">36组美发POS系统</a>
		</div>
		<!-- 搜索栏 -->
		<div>
			<form class="bs-example bs-example-form navbar-form navbar-left"
				role="search" action="search.action" method="post">
				<div class="row">
					<div>
						<div class="input-group">
							<div class="input-group-btn">
								<select class="form-control" name="search">
									<option name="range" value="1">服务类型</option>
									<option name="range" value="2">具体服务</option>
									<option name="range" value="3">VIP会员</option>
								</select>
							</div>
							<!-- /btn-group -->
							<input type="text" class="form-control" placeholder="请输入内容..."
								name="message"> <span class="input-group-btn">
								<button class="btn btn-default" type="submit">搜索</button>
							</span>
						</div>
						<!-- /input-group -->
					</div>
				</div>
				<!-- /.row -->
			</form>
		</div>

		<!-- 登录注册图标 -->
		<ul class="nav navbar-nav navbar-right">
			<li><a href="register.jsp"><span
					class="glyphicon glyphicon-user"></span> 注册</a></li>
			<li><a href="login.jsp"><span
					class="glyphicon glyphicon-log-in"></span> 登录</a></li>
		</ul>
	</div>
	</nav>

	<table class="table table-hover" id="center">
		<!-- <caption>基本的表格布局</caption> -->
		<thead>
			<tr>
				<th>名称</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td>店铺信息</td>
				<td>
					<button class="btn btn-primary" data-toggle="modal"
						data-target="#storeinfo">添加</button> <a class="btn btn-info"
					href="showSI.action" role="button">查看</a>
				</td>
				<!-- 店铺信息模态框（Modal） -->
				<div class="modal fade" id="storeinfo" tabindex="-1" role="dialog"
					aria-labelledby="myModalLabel" aria-hidden="true">
					<div class="modal-dialog">
						<div class="modal-content">
							<div class="modal-header">
								<button type="button" class="close" data-dismiss="modal"
									aria-hidden="true">&times;</button>
								<h4 class="modal-title" id="myModalLabel">店铺信息</h4>
							</div>
							<form name="storeInfoForm" onsubmit="return validateForm()"
								action="addStoreInfo.action" method="post">
								<div class="modal-body">
									<div class="form-group">
										<label for="name">店铺名称</label> <input type="text"
											class="form-control" id="name" placeholder="请输入名称（必须）"
											name="storeInfo.storeName">
									</div>
									<div class="form-group">
										<label for="name">店铺地址</label> <input type="text"
											class="form-control" id="addr" name="storeInfo.storeAddress">
									</div>
									<div class="form-group">
										<label for="name">店铺信息</label> <input type="text"
											class="form-control" id="info" name="storeInfo.storeInfo">
									</div>
									<div class="form-group">
										<label for="name">联系电话</label> <input type="text"
											class="form-control" id="tel" name="storeInfo.storePhone">
									</div>
									<!-- <button type="submit" class="btn btn-success btn-block">添加</button> -->

								</div>
								<div class="modal-footer">
									<button type="button" class="btn btn-default"
										data-dismiss="modal">关闭</button>
									<button type="submit" class="btn btn-primary">提交更改</button>
								</div>
							</form>
						</div>
						<!-- /.modal-content -->
					</div>
					<!-- /.modal -->
				</div>
			</tr>
			<tr>
				<td>服务类型</td>
				<td>
					<button class="btn btn-primary" data-toggle="modal"
						data-target="#serCate">添加</button> 
					<a class="btn btn-info"
						href="showSC.action" role="button">查看所有</a>
				</td>
				<!-- 服务类型模态框（Modal） -->
				<div class="modal fade" id="serCate" tabindex="-1" role="dialog"
					aria-labelledby="myModalLabel" aria-hidden="true">
					<div class="modal-dialog">
						<div class="modal-content">
							<div class="modal-header">
								<button type="button" class="close" data-dismiss="modal"
									aria-hidden="true">&times;</button>
								<h4 class="modal-title" id="myModalLabel">服务类型</h4>
							</div>
							<form name="serviceCategoryForm"
								onsubmit="return validateForm1()" action="addSerCate.action"
								method="post">
								<div class="modal-body">
									<div class="form-group">
										<label for="name">服务类型名称</label> <input type="text"
											class="form-control" id="name" placeholder="请输入名称（必须）"
											name="serviceCategory.serCateName">
									</div>
									<div class="form-group">
										<label for="name">注释</label> <input type="text"
											class="form-control" id="remark"
											name="serviceCategory.remark">
									</div>

								</div>
								<div class="modal-footer">
									<button type="button" class="btn btn-default"
										data-dismiss="modal">关闭</button>
									<button type="submit" class="btn btn-primary">添加</button>
								</div>
							</form>
						</div>
						<!-- /.modal-content -->
					</div>
					<!-- /.modal -->
				</div>

			</tr>
			<tr>
				<td>具体服务</td>
				<td>
					<!-- <button class="btn btn-primary" data-toggle="modal"
						data-target="#service">添加</button> --> <a class="btn btn-primary"
					href="findAllSC.action" role="button">添加</a> <a
					class="btn btn-info" href="showS.action" role="button">查看所有</a>
				</td>
				<!-- 具体服务模态框（Modal） 
				<div class="modal fade" id="service" tabindex="-1" role="dialog"
					aria-labelledby="myModalLabel" aria-hidden="true">
					<div class="modal-dialog">
						<div class="modal-content">
							<div class="modal-header">
								<button type="button" class="close" data-dismiss="modal"
									aria-hidden="true">&times;</button>
								<h4 class="modal-title" id="myModalLabel">具体服务</h4>
							</div>
							<form name="serviceForm" onsubmit="return myFunction2()"
								action="addService.action" method="post">
								<div class="modal-body">
									<div class="form-group">
										<label for="name">服务名称</label> <input type="text"
											class="form-control" id="name" placeholder="请输入名称（必须）"
											name="service.serviceName">
									</div>
									<div class="form-group">
										<label for="name">注释</label> <input type="text"
											class="form-control" id="remark" placeholder="请输入注释（可选）"
											name="service.remark">
									</div>
									<div class="form-group">
										<label for="name">价格</label> <input type="number"
											class="form-control" id="service.servicePrice"
											placeholder="请输入价格（必须）" name="service.servicePrice">
									</div>
									<div class="form-group">
										<label for="name">类型</label> <select name="serCateId"
											class="form-control">
											<s:iterator value="list" var="list">
												<option name="service.serCateId"
													value="<s:property value="#list.id"/>">
													<s:property value="#list.serCateName" />
												</option>
											</s:iterator>
										</select>
									</div>

								</div>
								<div class="modal-footer">
									<button type="button" class="btn btn-default"
										data-dismiss="modal">关闭</button>
									<button type="submit" class="btn btn-primary">添加</button>
								</div>
							</form>
						</div>						
					</div>
				</div> -->
			</tr>
			<tr>
				<td>VIP会员</td>
				<td>
					<!-- <button class="btn btn-primary" data-toggle="modal"
						data-target="#vip">添加</button> --> <a class="btn btn-primary"
					href="showAllStore.action" role="button">添加</a> <a
					class="btn btn-info" href="showVips" role="button">查看所有</a>
				</td>
				<!-- VIP会员模态框（Modal） 
				<div class="modal fade" id="vip" tabindex="-1" role="dialog"
					aria-labelledby="myModalLabel" aria-hidden="true">
					<div class="modal-dialog">
						<div class="modal-content">
							<div class="modal-header">
								<button type="button" class="close" data-dismiss="modal"
									aria-hidden="true">&times;</button>
								<h4 class="modal-title" id="myModalLabel">VIP会员</h4>
							</div>
							<form name="vipForm" onsubmit="return myFunction3()"
								action="addVip.action" method="post">
								<div class="modal-body">
									<div class="form-group">
										<label for="name">姓名</label> <input type="text"
											class="form-control" id="name" placeholder="请输入姓名（必须）"
											name="vip.vipName">
									</div>
									<div class="form-group">
										<label for="name">联系电话</label> <input type="text"
											class="form-control" id="name" name="vip.vipPhone">
									</div>
									<div class="form-group">
										<label for="name">性别</label> <input type="text"
											class="form-control" id="name" name="vip.vipSex">
									</div>
									<div class="form-group">
										<label for="name">备注</label> <input type="text"
											class="form-control" id="name" name="vip.remark">
									</div>
									<div class="form-group">
										<label for="name">消费次数</label> <input type="text"
											class="form-control" id="name" name="vip.consumptionTime">
									</div>
									<div class="form-group">
										<label for="name">店铺</label> <select name="storeId"
											class="form-control">
											<s:iterator value="list" var="list">
												<option name="vip.storeId"
													value="<s:property value="#list.id"/>">
													<s:property value="#list.storeName" />
												</option>
											</s:iterator>
										</select>
									</div>

								</div>
								<div class="modal-footer">
									<button type="button" class="btn btn-default"
										data-dismiss="modal">关闭</button>
									<button type="submit" class="btn btn-primary">添加</button>
								</div>
							</form>
						</div>
					</div>
				</div>
			</tr> -->
		</tbody>
	</table>

</body>
</html>
